<script setup>
import { ref } from 'vue'
import TitleValue from '@components/TitleValue'

const visible = ref(false)
const data = ref()

const open = (value) => {
    data.value = value
    visible.value = true
}

const close = () => {
    visible.value = false
    data.value = {}
}

//把方法暴露给父组件
defineExpose({
    open
})
</script>
    
<template>
    <el-dialog v-model="visible" title="提现申请" center @close="close" destroy-on-close :width="500">
        <section v-if="data">
            <title-value title="提现状态" :value="data.status == 0? '已提交待审核' : (data.status == 1 ? '已撤回':(data.status == 2 ? '已驳回' : (data.status == 3 ? '审核通过待打款' : '已打款') )) " />
            <section class="marginT10">
                <div class="color-1 font3 bold">申请信息</div>
                <title-value title="提现金额" :value="data.withdrawAmount" />
                <title-value title="申请商户" :value="data.companyName" />
                <title-value title="申请时间" :value="data.applyTime" />
                <title-value title="收款人" :value="data.payeeName" />
                <title-value title="收款账户" :value="data.payeeAccountNo" />
                <title-value title="收款类型" :value="data.payeeAccountType" />
            </section>
            <section class="marginT10" v-if="data.status == 4 || data.status == 3">
                <div class="color-1 font3 bold">审核信息</div>
                <title-value title="审核时间" :value="data.auditTime" />
                <title-value title="审核人" :value="data.auditorName" />
                <title-value title="备注" :value="data.auditRemark" />
            </section>
            <section class="marginT10" v-if="data.remitTime">
                <div class="color-1 font3 bold">打款信息</div>
                <title-value title="打款时间" :value="data.remitTime" />
                <title-value title="打款人" :value="data.remitterName" />
                <title-value title="备注" :value="data.remitRemark" />
            </section>
            <section class="marginT10" v-if="data.status == 2">
                <div class="color-1 font3 bold">驳回信息</div>
                <title-value title="驳回时间" :value="data.auditTime" />
                <title-value title="驳回人" :value="data.auditorName" /> 
                <title-value title="备注" :value="data.auditRemark" />
            </section>
            <section class="marginT10" v-if="data.status == 1">
                <div class="color-1 font3 bold">撤回信息</div>
                <title-value title="撤回人" :value="data.revocationName" />
                <title-value title="撤回时间" :value="data.revokeTime" />
            </section>
        </section>
    </el-dialog>
</template>
    